package ru.niir.goodfil.audit.domain;

import ru.niir.goodfil.audit.util.Assert;

import javax.persistence.Column;
import javax.persistence.Entity;

/**
 * @author: Кирилл
 */
@Entity
public class SettingModificationEvent extends Event {
    @Column(length = 200)
    private String optionKey;
    @Column(length = 300)
    private String newOptionValue;
    @Column(length = 300)
    private String oldOptionValue;

    private SettingModificationEvent() {
    }

    public SettingModificationEvent(String ip, String login, String optionKey, String newOptionValue, String oldOptionValue) {
        Assert.notBlank(optionKey);

        this.ip = ip;
        this.login = login;
        this.optionKey = optionKey;
        this.newOptionValue = newOptionValue;
        this.oldOptionValue = oldOptionValue;
    }

    public String getOptionKey() {
        return optionKey;
    }

    public void setOptionKey(String optionKey) {
        this.optionKey = optionKey;
    }

    public String getNewOptionValue() {
        return newOptionValue;
    }

    public void setNewOptionValue(String newOptionValue) {
        this.newOptionValue = newOptionValue;
    }

    public String getOldOptionValue() {
        return oldOptionValue;
    }

    public void setOldOptionValue(String oldOptionValue) {
        this.oldOptionValue = oldOptionValue;
    }

    @Override
    public String toString() {
        return "SettingModificationEvent{" +
                "optionKey='" + optionKey + '\'' +
                ", newOptionValue='" + newOptionValue + '\'' +
                ", oldOptionValue='" + oldOptionValue + '\'' +
                '}';
    }
}
